﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_GetNewDocument]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_GetNewDocument];
GO
CREATE PROCEDURE [dbo].[sproc_GetNewDocument] 
    @ClassID int
/*

============================================================
功能:    得到组中最新文档
参数:
    @ClassID int        :    被查询的组ID

============================================================

*/

AS

SELECT * 
    FROM 
        uds_document 
    WHERE     ClassID = @classid 
        and docdeletion =0     
        and doctype =0 
        and docapproved=1
    ORDER BY docaddeddate DESC